/* pages/index/index.less */

// 颜色定义 (独立导入)
@main-text-color: #303133; // 主要文字
@regular-text-color: #606266; // 常规文字
@secondary-text-color: #909399; // 次要文字
@placeholder-text-color: #c0c4cc; // 占位文字

// 主题色 (独立导入)
@theme-color-1: #19be6b; // 主题色
@theme-color-2: #18b566; // 主题色（深色，用于hover/active）

// 提示色 (独立导入)
@danger-color: #f56c6c; // 危险
@warning-color: #f9ae3d; // 警告

// 字体大小 (独立导入)
@font-size-lg: 28rpx; // 大
@font-size-md: 26rpx; // 中
@font-size-nm: 24rpx; // 普通
@font-size-sm: 22rpx; // 小

// 课程卡片背景色与文字色 (独立导入)
@course-bg-orange: #fff0e7;
@course-text-orange: #d4603a;
@course-bg-blue: #e7f0ff;
@course-text-blue: #3a6cd4;
@course-bg-green: #e7ffe7;
@course-text-green: #3a943a;

.container {
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* 头部样式 */
.header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 40rpx;
  padding: 20rpx;

  .header-title {
    font-size: @font-size-lg;
    font-weight: bold;
    color: @main-text-color;
    margin-right: 20rpx;
  }

  .header-date {
    font-size: @font-size-nm;
    color: @regular-text-color;
  }

  .header-week {
    font-size: @font-size-nm;
    color: @regular-text-color;
    margin-left: 20rpx;
  }

  .warning-text {
    color: @warning-color;
  }
}

/* 今日课程区域 */
.today-courses-section {
  flex: 1;
  padding: 0 20rpx 40rpx;
}

/* t-steps 组件深度定制 */
.course-steps {
  // 覆盖 t-steps 默认的 padding，使其内容更紧凑
  --td-steps-item-content-padding: 0 0 40rpx 40rpx;

  // 步骤标题，用于显示时间
  .step-title {
    font-size: @font-size-md;
  }

  // 课程卡片样式
  .course-card {
    background-color: #ffffff;
    border-radius: 16rpx;
    padding: 24rpx 30rpx;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 120rpx;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;

    &:active {
      transform: translateY(2rpx);
      box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
    }

    .course-name {
      font-size: @font-size-md;
      font-weight: bold;
      margin-bottom: 10rpx;
      line-height: 1.4;
    }

    .course-info {
      font-size: @font-size-sm;
      color: @secondary-text-color;
    }
  }

  // 禁用的课程卡片样式
  .course-card-disabled {
    opacity: 0.6;
    filter: grayscale(80%);

    .course-name {
      color: @secondary-text-color;
    }
  }

  // 各种颜色的课程卡片
  .course-card-orange {
    background-color: @course-bg-orange;

    .course-name {
      color: @course-text-orange;
    }
  }

  .course-card-blue {
    background-color: @course-bg-blue;

    .course-name {
      color: @course-text-blue;
    }
  }

  .course-card-green {
    background-color: @course-bg-green;

    .course-name {
      color: @course-text-green;
    }
  }
}

/* 空状态提示 */
.empty-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80rpx 0;

  .empty-text {
    font-size: @font-size-nm;
    color: @secondary-text-color;
    display: block;
    margin-top: 20rpx;
    margin-bottom: 40rpx;
  }

  .add-course-btn-empty {
    width: 60%;
    background-color: @theme-color-1;
    border-color: @theme-color-1;

    &:active {
      background-color: @theme-color-2;
      border-color: @theme-color-2;
    }

    .van-icon {
      margin-right: 10rpx;
    }
  }
}

/* 底部操作按钮 */
.footer-actions {
  display: flex;
  justify-content: space-between;
  padding: 30rpx;
  background-color: #ffffff;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.03);
  padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
  padding-bottom: calc(20rpx + env(safe-area-inset-bottom));

  .action-button {
    flex:1;
    &.van-button--primary {
      background-color: @theme-color-1;
      border-color: @theme-color-1;

      &:active {
        background-color: @theme-color-2;
        border-color: @theme-color-2;
      }
    }

    &.van-button--plain.van-button--info {
      color: @theme-color-1;
      border-color: @theme-color-1;

      &:active {
        color: @theme-color-2;
        border-color: @theme-color-2;
      }
    }
  }
}

/* 完整课表弹窗样式 */
.popup-title {
  font-size: @font-size-lg;
  font-weight: bold;
  color: @main-text-color;
  text-align: center;
  padding: 30rpx 0;
  border-bottom: 1rpx solid #eee;
}

.invalid-settings-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100% - 100rpx);
  padding: 40rpx;
  box-sizing: border-box;
  text-align: center;

  .tip-text {
    font-size: @font-size-md;
    color: @warning-color;
    margin-top: 20rpx;
    line-height: 1.5;
  }
}

.schedule-grid-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100% - 100rpx);
  overflow: hidden;
}

.grid-header,
.grid-row {
  display: flex;
  flex-shrink: 0;
}

.grid-header {
  background-color: #fff;
  border-bottom: 1rpx solid #eee;
  position: sticky;
  top: 0;
  z-index: 10;
}

.grid-cell {
  border: 1rpx solid #f0f0f0;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  padding: 10rpx 5rpx;

  &:first-child {
    width: 160rpx;
    flex-shrink: 0;
  }

  flex: 1;
}

.current-week-cell {
  background-color: @theme-color-1;
  color: #fff;
  font-size: @font-size-md;
  font-weight: bold;
}

.weekday-header-cell {
  background-color: #f7f8fa;
  font-size: @font-size-nm;
  color: @regular-text-color;

  &.current-day-active {
    background-color: lighten(@theme-color-1, 40%);
    color: @theme-color-1;
    font-weight: bold;
  }

  .weekday-text {
    font-weight: bold;
    margin-bottom: 4rpx;
  }

  .date-text {
    font-size: @font-size-sm;
    color: @secondary-text-color;
  }
}

.grid-body {
  flex: 1;
  overflow-y: scroll;
}

.grid-row {
  .lesson-time-cell {
    background-color: #f7f8fa;
    font-size: @font-size-nm;
    color: @regular-text-color;
    font-weight: bold;

    .lesson-index {
      font-size: @font-size-md;
      color: @main-text-color;
      margin-bottom: 5rpx;
    }

    .time-range {
      font-size: @font-size-sm;
      color: @secondary-text-color;
    }
  }

  .course-cell {
    min-height: 150rpx;
    justify-content: flex-start;
    align-items: stretch;
    position: relative;
    padding: 5rpx;

    .course-item-card {
      flex: 1;
      border-radius: 12rpx;
      padding: 10rpx;
      margin-bottom: 5rpx;
      display: flex;
      flex-direction: column;
      justify-content: center;
      text-align: left;
      font-size: @font-size-sm;
      line-height: 1.3;
      box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.03);

      &:last-child {
        margin-bottom: 0;
      }

      .course-name {
        font-weight: bold;
        margin-bottom: 5rpx;
        font-size: @font-size-nm;
      }

      .course-info {
        color: @secondary-text-color;
        font-size: @font-size-sm;
      }
    }

    .course-item-card-orange {
      background-color: @course-bg-orange;

      .course-name {
        color: @course-text-orange;
      }
    }

    .course-item-card-blue {
      background-color: @course-bg-blue;

      .course-name {
        color: @course-text-blue;
      }
    }

    .course-item-card-green {
      background-color: @course-bg-green;

      .course-name {
        color: @course-text-green;
      }
    }

    .course-card-disabled {
      opacity: 0.6;
      filter: grayscale(80%);

      .course-name {
        color: @secondary-text-color;
      }
    }

    .empty-course-placeholder {
      flex: 1;
    }
  }
}

.no-lesson-tip {
  padding: 100rpx 0;
  text-align: center;
  font-size: @font-size-nm;
  color: @secondary-text-color;
}